Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance: refactor delete mvcc function (#38066) #39258

Merged
merged 1 commit into from
Jan 15, 2025

Conversation

zhagnlu
Copy link
Contributor

@zhagnlu zhagnlu commented Jan 14, 2025

pr: #38066, #38509, #38549, #38580, #38991 cherry-pick from master

@sre-ci-robot sre-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines. label Jan 14, 2025
Copy link
Contributor

mergify bot commented Jan 14, 2025

@zhagnlu Thanks for your contribution. Please submit with DCO, see the contributing guide https://github.com/milvus-io/milvus/blob/master/CONTRIBUTING.md#developer-certificate-of-origin-dco.

@mergify mergify bot added the needs-dco DCO is missing in this pull request. label Jan 14, 2025
Copy link
Contributor

mergify bot commented Jan 14, 2025

@zhagnlu Please associate the related pr of master to the body of your Pull Request. (eg. “pr: #”)

@mergify mergify bot added do-not-merge/missing-related-pr kind/enhancement Issues or changes related to enhancement labels Jan 14, 2025
@zhagnlu zhagnlu force-pushed the refactor_delete_2.4 branch from 62492c9 to 971b7d9 Compare January 14, 2025 11:44
@mergify mergify bot added dco-passed DCO check passed. and removed needs-dco DCO is missing in this pull request. labels Jan 14, 2025
@zhagnlu zhagnlu force-pushed the refactor_delete_2.4 branch from 971b7d9 to 5f134d8 Compare January 14, 2025 13:07
@mergify mergify bot added the ci-passed label Jan 14, 2025
Copy link

codecov bot commented Jan 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.44%. Comparing base (8da3ec8) to head (376724a).
Report is 5 commits behind head on 2.4.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##              2.4   #39258      +/-   ##
==========================================
+ Coverage   79.50%   83.44%   +3.93%     
==========================================
  Files        1077      811     -266     
  Lines      169767   143417   -26350     
==========================================
- Hits       134974   119674   -15300     
+ Misses      30297    19244   -11053     
- Partials     4496     4499       +3     

see 308 files with indirect coverage changes

}
for (auto& offset : offsets) {
auto row_id = offset.get();
// if alreay deleted, no need to add new record
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if ignoring deleted entries are safe or not. Say we have the following sequence of operations:

DELETE (K1, T0)
INSERT (K1, T1)
DELETE (K1, T2)

do you mean the 3rd operation is ignored here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when delete, all k1 will convert to [offset, ts], not just [k1, ts], so the 3rd operation will do:

  1. find all exist offset that meet pk is k1, include 2rd insert, and 2rd insert is a new offset
  2. judge whether offsets from 1 is deleted or not. if offset is deleted, not add new record, if not, add new record.
    so the 3rd not fully ignored

Comment on lines 175 to 176
if (!snapshots_.empty()) {
int loc = snapshots_.size() - 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The access of snapshots_ here is not protected by lock snap_lock_, is it OK?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, need to lock it actully, I will move the lock below to the top

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update it

@zhagnlu zhagnlu force-pushed the refactor_delete_2.4 branch from 5f134d8 to 376724a Compare January 15, 2025 08:10
@mergify mergify bot removed the ci-passed label Jan 15, 2025
@tedxu
Copy link
Contributor

tedxu commented Jan 15, 2025

/lgtm

std::move(segment_->search_pk(deleted_pk, deleted_ts));
} else {
// only for testing
offsets = std::move(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not add test code here in the future.
You should encapsulate the search_pk as a function pointer within DeleteRecord. Pass the function object from outside.

@czs007
Copy link
Collaborator

czs007 commented Jan 15, 2025

/approve

@sre-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: czs007, zhagnlu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sre-ci-robot sre-ci-robot merged commit 8b1e904 into milvus-io:2.4 Jan 15, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved ci-passed dco-passed DCO check passed. kind/branch-feature kind/enhancement Issues or changes related to enhancement lgtm size/XXL Denotes a PR that changes 1000+ lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants